package com.msb.mall.product.web;

/**
 * @Auther: xixifeng
 * @Date: 2022/11/3 - 11 - 03 - 9:53
 * @Description: com.msb.mall.product.web
 * @version: 1.0
 */

import com.msb.mall.product.service.SkuInfoService;
import com.msb.mall.product.vo.SpuItemVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 商品详情的控制器
 */
@Controller
public class ItemController {

    @Autowired
    SkuInfoService skuInfoService;

    @GetMapping("/{skuId}.html")
    public String item(@PathVariable Long skuId , Model model) {
        SpuItemVO itemVO = skuInfoService.item(skuId);
        System.out.println(itemVO);
        model.addAttribute("item", itemVO);
        return "item";
    }

}
